#include<stdio.h>
#include<unistd.h>
#include<sys/types.h>
#include<wait.h>
#include<stdlib.h>
char* const myenv[] = 
{
    (char* const) "MYENV=10086",
     NULL
};
extern char** environ;
int main()
{
  printf("程序开始运行\n");
  if(fork() == 0)
  {
     // execl("/usr/bin/ls","ls","-l",NULL);
     // execlp("ls","ls","-l",NULL);
     
    char* const argv[]=
    {
     (char* const) "ls",
     (char* const) "-l",
      NULL
    };
    int i = 0;
    for(i = 0;myenv[i];i++)
    {
      putenv(myenv[i]);
    }
    execvpe("./a",argv,environ);
    // execv("/usr/bin/ls",argv);
    //execvp("argv[0]",argv);
     exit(1);
  }
  waitpid(-1,NULL,0);
  printf("程序运行结束了\n");
  return 0;
}
